const label = '图片'
const name = 'img'

export default {
  icon: 'icon-span',
  label,
  name,
  rule() {
    return {
      type: name,
      title: '',
      native: false,
      children: [''],
      style: {
      },
      attrs: {
        src: ''
      },
      class: ''
    }
  },
  props() {
    return [
      // {
      //   type: 'input',
      //   field: 'formCreateAttrs>src',
      //   title: '图片路径',
      //   props: {
      //     type: 'input'
      //   }
      // },
      {
        type: 'col',
        props: {
          span: 24
        },
        children: [
          {
            type: 'el-button',
            props: {
              type: 'primary',
              size: 'mini',
              icon: ''
            },
            inject: true,
            on: {
              click({ $f }) {
                // console.log($f, rule, self, option, inject, args, 'f, rule, self, option, inject, args>>>>>>>>>>>>')
                const rule = $f.activeRule
                let fc = rule.__fc__.vm
                console.log(rule, 'argsargsargs')
                let i = 0
                while (i < 20) {
                  if (!fc._data.attachmentType) {
                    i++ // 防止死循环
                    fc = fc.$parent
                    continue
                  }
                  break
                }
                // console.log($f)
                fc.openFileBox(rule._id, $f)
              }
            },
            native: true,
            children: ['选择图片']
          }
        ]
      },
      {
        type: 'input',
        field: 'formCreateClass',
        title: '类名',
        props: {
          type: 'input'
        }
      },
      {
        type: 'select',
        field: 'formCreateStyle>float',
        title: '浮动方式',
        options: [{
          label: '左浮动',
          value: 'left'
        }, {
          label: '右浮动',
          value: 'right'
        }, {
          label: '不浮动',
          value: 'none'
        }]
      }
    ]
  }
}
